home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / rpl000012.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  1.1 KB  |  46 lines  |  [TEXT/ttxt]

  1. source include/master-slave.inc;
  2. connection master;
  3. drop table if exists t1,t2,t3;
  4.  
  5. create table t2 (n int);
  6. create temporary table t1 (n int);
  7. insert into t1 values(1),(2),(3);
  8. insert into t2 select * from t1;
  9. drop table if exists test.t3;
  10. create temporary table test.t3 (n int not null);
  11. alter table test.t3 add primary key(n);
  12. flush logs;
  13. insert into t3 values (100);
  14. insert into t2 select * from t3;
  15. drop table if exists test.t3;
  16. insert into t2 values (101);
  17. connection master1;
  18. create temporary table t1 (n int);
  19. insert into t1 values (4),(5);
  20. insert into t2 select * from t1;
  21. save_master_pos;
  22. disconnect master;
  23. connection slave;
  24.  
  25. #add 1 to the saved position, so we will catch  drop table on disconnect
  26. #for sure
  27. sync_with_master 1;
  28. connection master1;
  29. insert into t2 values(6);
  30. save_master_pos;
  31. disconnect master1;
  32. connection slave;
  33. #same trick - make sure we catch drop of temporary table on disconnect
  34. sync_with_master 1;
  35. select * from t2;
  36. show status like 'Slave_open_temp_tables';
  37. #
  38. # Clean up
  39. #
  40. connect (master2,localhost,root,,);
  41. connection master2;
  42. drop table if exists t1,t2;
  43. save_master_pos;
  44. connection slave;
  45. sync_with_master;
  46.